/**
 * @param {string} corridor
 * @return {number}
 */
 var numberOfWays = function(corridor) {
  const M = 1e9 + 7
  let arr = []
  for(let i = 0; i<corridor.length; i++){
    if(corridor[i] === 'S') arr.push(i)
  }
  let cnt = arr.length
  if(cnt & 1 || cnt === 0) return 0
  if(cnt === 2) return 1
  let ans = 1
  for(let i = 1; i<arr.length-2; i+=2){
    let diff = arr[i+1] - arr[i]
    ans = (ans * diff) % M
  }
  return ans
};